﻿Public Class frmMessageBox

    Private Countdown As Integer = 4
    Private _Message As String
    Public Property Message() As String
        Get
            Return _Message
        End Get
        Set(ByVal data As String)
            _Message = data
        End Set
    End Property

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Close()
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Countdown -= 1
        If (Countdown <= 0) Then
            Me.Close()
        Else
            'Label2.Text = String.Format("The program will be closed in {0} second(s).", Countdown)
            Label2.Text = "The from will be closed in " & Countdown & " second(s)."
        End If
    End Sub

    Private Sub frmMessageBox_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.lblMessage.Text = Message
        If (Me.Countdown = 0) Then Me.Countdown = 3
        Me.Timer1.Interval = 1000
        Me.Timer1.Enabled = True
    End Sub
End Class